<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${page.number}" />
	<input type="hidden" name="viewRequest.size" value="${page.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
	
	<input type="hidden" name="sellerName" value="${sellerName}" />
	<input type="hidden" name="storageName" value="${storageName}" />
	<input type="hidden" name="expressName" value="${expressName}" />
	<input type="hidden" name="memberName" value="${memberName}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return storageOrders_navSearch(this);" action="${rootUrl}/order/storage-order" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 75px">
			<li>
				<label>一级编号：</label>
				<input type="text" name="viewRequest.params['s_dot_orderCode_like']" value="${viewRequest.params.s_dot_orderCode_like}"/>
			</li>
			<li>
				<label>仓库订单编号：</label>
				<input type="text" name="viewRequest.params['_and_s_dot_code_like']" value="${viewRequest.params._and_s_dot_code_like}"/>
			</li>
			<li>
				<label>下单用户：</label>
				<input type="hidden" id="stgoMemberId" name="member.id" value="${viewRequest.params._and_s_dot_member_dot_id_eq_string}"/>
				<input type="text" id=stgoMemberName name="member.name" style="float:left" value="${memberName}"/>
				<a class="btnLook" href="${rootUrl}/member/member/1/dialog" width="800" height="720" lookupGroup="member">会员</a>
			</li>
			<li>
				<label>商家：</label>
				<input type="hidden" id="stgoSellerId" name="seller.id" value="${viewRequest.params._and_s_dot_seller_dot_id_eq_string}"/>
				<input type="text" id="stgoSellerName" style="float:left" name="seller.name" value="${sellerName}"/>
				<a class="btnLook" href="${rootUrl}/seller/seller/1/dialog" width="800" height="720" lookupGroup="seller">商家</a>
			</li>
			<li>
				<label>仓库：</label>
				<input type="hidden" id="stgoStorageId" name="storage.id" value="${viewRequest.params._and_s_dot_storage_dot_id_eq_string}"/>
				<input type="text" id="stgoStorageName" style="float:left" name="storage.name" value="${storageName}"/>
				<a class="btnLook" href="${rootUrl}/seller/storage/0/dialog?sellerId={sellerId}" warn="请选择商家" lookupGroup="storage">仓库</a>
			</li>
			<li>
				<label>快递公司：</label>
				<input type="hidden" id="stgoExpressId" name="express.id" value="${viewRequest.params._and_s_dot_express_dot_id_eq_string}"/>
				<input type="text" id="stgoExpressName" style="float:left" name="express.name" value="${expressName}"/>
				<a class="btnLook" href="${rootUrl}/seller/express/0/dialog?sellerId={sellerId}" warn="请选择商家" lookupGroup="express">快递公司</a>
			</li>
			<li>
				<label>运单号：</label>
				<input type="text" name="viewRequest.params['_and_s_dot_expressCode_like']" value="${viewRequest.params._and_s_dot_expressCode_like}"/>
			</li>
			<li style="width: 500px">
				<label>支付时间：</label>
				<input name="viewRequest.params['_and_s_dot_order_dot_payTime_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_order_dot_payTime_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_s_dot_order_dot_payTime_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_order_dot_payTime_le_date'] }" placeholder="结束时间"/>
			</li>
			<li style="width: 500px">
				<label>发货时间：</label>
				<input name="viewRequest.params['_and_s_dot_deliveryTime_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_deliveryTime_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_s_dot_deliveryTime_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_s_dot_deliveryTime_le_date'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>订单状态：</label>
				<select name="viewRequest.params['_and_g_dot_state_eq_string']">
					<option value="" <c:if test="${viewRequest.params._and_g_dot_state_eq_string == ''}">selected="selected"</c:if>>全部</option>
					<c:forEach var="item" items="${orderState}">   
						<option value="${item.key}" <c:if test="${viewRequest.params._and_g_dot_state_eq_string == item.key}">selected="selected"</c:if>>${item.value}</option>
					</c:forEach>  
				</select>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
		<li><a class="icon" href="${rootUrl}/order/storage-order/0/batchExcelExportUI" target="dialog" width="800" height="600" rel="batchExcelExport"><span>导出EXCEL</span></a></li>
		<li><a class="add" href="${rootUrl}/order/storage-order/0/impXls" width="1320" height="720" target="dialog" rel="imp_express" title="导入快递单"><span>导入快递单</span></a></li>
		</ul>
	</div>
	<table class="table" targetType="navTab"  width="100%" layoutH="186">
		<thead>
			<tr>
				<!-- <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl"></th> -->
				<th width="30" align="center" >序号</th>
				<th width="100">订单编号</th>
				<th width="100">仓库订单编号</th>
				<th width="70">仓库名称</th>
				<th width="70">快递名称</th>
				<th width="100">运单号</th>
				<th width="70">订单状态</th>
				<th width="100">支付时间</th>
				<th width="100">发货时间</th>
				<th width="100">确认收货时间</th>
				<th width="100">截止收货时间</th>
				<th width="60">是否延迟收货</th>
				<th width="50">重量（克）</th>
				<th width="50">运费</th>
				<th width="50">超重运费</th>
				<th width="50">买家</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.content}" var="storageOrder" varStatus="status">
			<tr target="data_id" rel="${storageOrder.id}">
				<%-- <td><input name="ids" value="${storageOrder.id}" type="checkbox"></td> --%>
				<td>${status.count}</td>
				<td>${storageOrder.orderCode}</td>
				<td>${storageOrder.code}</td>
				<td>${storageOrder.storage.name}</td>
				<td>${storageOrder.express.name}</td>
				<td>${storageOrder.expressCode}</td>
				<td>${orderState[storageOrder.state] }</td>
				<td><fmt:formatDate value="${storageOrder.order.payTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${storageOrder.deliveryTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${storageOrder.receiptTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><fmt:formatDate value="${storageOrder.receiptEndTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td><c:if test="${storageOrder.isDelayed == 0}">否</c:if><c:if test="${storageOrder.isDelayed == 1}">是</c:if></td>
				<td class="listMoneyField">${storageOrder.weight}</td>
				<td class="listMoneyField"><fmt:formatNumber value="${storageOrder.freight/100}" pattern="0.00"/></td>
				<td class="listMoneyField"><fmt:formatNumber value="${storageOrder.overweightFreight/100}" pattern="0.00"/></td>
				<td>${storageOrder.order.name}</td>
				<td>
				    <a title="浏览" target="dialog"  max="true" rel="goodsOrder_show" title="浏览"  href="${rootUrl}/order/storage-order/${storageOrder.id}/edit" class="btnView">浏览</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${page.size}">${page.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${page.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="navTab" totalCount="${page.totalElements}" numPerPage="${page.size}" pageNumShown="10" currentPage="${page.number}"></div>
	</div>
</div>
<script>
	function storageOrders_navSearch(obj){
		$("#stgoSellerId").attr("name","viewRequest.params['_and_s_dot_seller_dot_id_eq_string']");
		$("#stgoSellerName").attr("name","sellerName");
		$("#stgoStorageId").attr("name","viewRequest.params['_and_s_dot_storage_dot_id_eq_string']");
		$("#stgoStorageName").attr("name","storageName");
		$("#stgoExpressId").attr("name","viewRequest.params['_and_s_dot_express_dot_id_eq_string']");
		$("#stgoExpressName").attr("name","expressName");
		$("#stgoMemberId").attr("name","viewRequest.params['_and_s_dot_member_dot_id_eq_string']");
		$("#stgoMemberName").attr("name","memberName");
		
		if($("#stgoSellerName").val() == ""){
			$("#stgoSellerId").val("");
		}
		if($("#stgoStorageName").val() == ""){
			$("#stgoStorageId").val("");
		}
		if($("#stgoExpressName").val() == ""){
			$("#stgoExpressId").val("");
		}
		if($("#stgoMemberName").val() == ""){
			$("#stgoMemberId").val("");
		}
		return navTabSearch(obj);
	}
</script>